<script  type="text/javascript">
  $(function()
  {	  
	   $('.xoahinh').click(function()
	   {
		  var maha = $(this).attr("id");
		  
		  $('#dialog_xoa').dialog(
		  {
			  autoOpen: false,
			  modal: true,
			  buttons: 
			  {
				  "Xóa": function() 
				  {
					  $(this).dialog("close");
					  
					  var button_data = {
			   								maha: maha,
											maks: $('#maks').val()
										};
			          $.ajax(
		   			  {
						 url: "index.php/khachsan/XoaHinh",
						 type: 'POST',
						 data: button_data,
						 success: function(msg)
						 {
							$('#hinhanh').html(msg);
						 }
					  });
				  },
				  
				  "Không": function() 
				  {
					  $(this).dialog("close");
				  }
			  }
		  });

		  $('#dialog_xoa').dialog('open');
		   
	   });
  });
</script>
<?php
	$str = "";
	
	if($hinhanh)
	{
		foreach($hinhanh as $row)
		{
			$maha = $row->MaHA;
			$hinhnho = $row->HinhNho;
				
			$str = $str . "<p style='margin-left:50px'>
							<img src='$hinhnho' style='max-height:100px;'/>
							<a href='javascript:void(0)' class='xoahinh' id='$maha' title='Xóa'><img src='resources/admin/images/icons/cross.png' style='margin-bottom:85px' /></a>
						</p>";
		}
							
		$str = $str . "</p>";
	}
	else
		$str = $str . "<p style='margin-left:20px'>(không có)</p>";
	
	echo $str;
?>